package org.obm.bigg.mgmt;

import java.util.HashSet;
import java.util.Set;

public class Acl {
	private BigBox what;
	private String who;
	private Set<BoxRights> rights;

	public Acl(String who, BigBox what, Set<BoxRights> rights) {
		this.who = who;
		this.what = what;
		this.rights = rights;
	}

	public Acl(String who, BigBox what, BoxRights... rights) {
		this(who, what, asSet(rights));
	}

	private static Set<BoxRights> asSet(BoxRights... rights) {
		HashSet<BoxRights> r = new HashSet<BoxRights>();
		for (BoxRights br : rights) {
			r.add(br);
		}
		return r;
	}

	public BigBox getWhat() {
		return what;
	}

	public String getWho() {
		return who;
	}

	public Set<BoxRights> getRights() {
		return rights;
	}
}
